package main

import (
	"fmt"
	"os"

	cobra "gitee.com/li-haowei/cobra"
)

var testNum int

var rootCmd = &cobra.Command{
	Use:   "version",
	Short: "A brief description of your command",
	Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command.`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("test %d called\n", testNum)
	},
}

func Execute() {
	if err := rootCmd.Execute(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}

func init() {
	rootCmd.Flags().IntVarP(&testNum, "testNum", "t", 0, "test num")
}

func main() {
	Execute()
}
